
function checkJobSeeker(form)
{
    var msg = "";
    
    if(form.username.value == "") {
        msg+="+ Username cannot be blank!\n";
        form.username.focus();
    //return false;
    } 
    re = /^\w+$/;
    if(!re.test(form.username.value) && form.username.value != "") {
        msg+="+ Username must contain only letters, numbers and underscores!\n";
        form.username.focus();
    //return false;
    }

    if(form.password.value == "") {
        msg+="+ Password cannot be blank!\n";
        form.password.focus();
    //return false;
    }
    if(form.password.value.length < 6) {
        msg+="+ Password must contain at least six characters!\n";
        form.password.focus();
    //return false;
    }
    if(form.password.value != form.rePassword.value) {
        msg+="+ Please check that you've entered and confirmed your password!\n";
        form.password.focus();
    //return false;
    }

    if(form.fullname.value == "") {
        msg+="+ Fullname cannot be blank!\n";
        form.fullname.focus();
    //return false;
    }

    if(form.city.value == "") {
        msg+="+ City cannot be blank!\n";
        form.city.focus();
    //return false;
    }

    if(form.phone.value == "") {
        msg+="+ Phone number cannot be blank!\n";
        form.phone.focus();
    //return false;
    }

    /*if(isNaN(form.phone.value)) {
        alert("Error: Phone is number only!");
        form.phone.focus();
        return false;
    } */
    if(msg != ""){
        alert('Cac loi sau duoc tim thay:\n\n'+msg);
        return false;
    }

    else {
        return true;
    }
}


function checkEmployer(form)
{
    var msg = "";
    if(form.username.value == "") {
        msg+="+ Username cannot be blank!\n";
        form.username.focus();
    //      return false;
    } 
    re = /^\w+$/;
    if(!re.test(form.username.value) && form.username.value != "") {
        msg+="+ Username must contain only letters, numbers and underscores!\n";
        form.username.focus();
    //        return false;
    }

    if(form.password.value == "") {
        msg+="+ Password cannot be blank!\n";
        form.password.focus();
    //      return false;
    } 

    if(form.password.value.length < 6) {
        msg+="+ Password must contain at least six characters!\n";
        form.password.focus();
    //            return false;
    }
    if(form.password.value != form.rePassword.value) {
        msg+="+ Please check that you've entered and confirmed your password!\n";
        form.password.focus();
    //        return false;
    }

    if(form.companyName.value == "") {
        msg+="+ Company Name cannot be blank!\n";
        form.companyName.focus();
    //        return false;
    }

    if(form.companyAddress.value == "") {
        msg+="+ Company Address cannot be blank!\n";
        form.companyAddress.focus();
    //        return false;
    }

    if(form.city.value == "") {
        msg+="+ City cannot be blank!\n";
        form.city.focus();
    //        return false;
    }

    if(form.fullname.value == "") {
        msg+="+ Fullname cannot be blank!\n";
            form.fullname.focus();
    //        return false;
    }

    if(form.currentPos.value == "") {
        msg+="+ Current position cannot be blank!\n";
        form.currentPos.focus();
    //        return false;
    }

    if(form.phone.value == "") {
        msg+="+ Phone number cannot be blank!\n";
        form.phone.focus();
    //        return false;
    }

    /*if(isNaN(form.phone.value)) {
        alert("Error: Phone is number only!");
        form.phone.focus();
        return false;
    }*/

    if(form.email.value == "") {
        msg+="+ Email cannot be blank!\n";
        form.email.focus();
    //        return false;
    }

    /*var re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    if(!re.test(form.email.value)) {
        alert("Error: Invalid email address");
//        form.email.focus();
//        return false;
    }*/
    if(msg != ""){
        alert("Cac loi sau duoc tim thay:\n\n"+msg);
        return false;
    }

    else {
        return true;
    }
}

